package com.lin.cli.command;


import picocli.CommandLine;

import java.io.File;
import java.util.Objects;

@CommandLine.Command(name = "list", description = "遍历文件", mixinStandardHelpOptions = true)
public class ListCommand implements Runnable{

    @Override
    public void run() {
        //1:获取相对目录位置
        String property = System.getProperty("user.dir");
        //2:获取文件根路径
        File parentFile = new File(property).getParentFile();
        //3:遍历文件
        for (File file : Objects.requireNonNull(parentFile.listFiles())) {
            System.out.println(file);
        }
    }
}
